<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">


<h:body>
    <h:form id="addMaterialDialogForm">
        <h:panelGrid columns="2" cellpadding="10">
            <h:outputLabel for="material_name" value="Введите название материала"/>
            <p:inputText id="material_name" value="#{materialsBean.equipment.name}" required="true"/>

            <h:outputLabel for="material_full_name" value="Введите полное название материала"/>
            <p:inputText id="material_full_name" value="#{materialsBean.equipment.fullName}" required="true"/>


            <h:outputText  value="Выберите единицы измерения"/>
            <p:selectOneMenu value="#{materialsBean.unit.name}" effect="fold" editable="true">
                <f:selectItem itemLabel="Выберите единицы измерения" itemValue="" />
                <f:selectItems value="#{materialsBean.unitsList}" />
            </p:selectOneMenu>

            <h:outputText  value="Выберите тип материала"/>
            <p:selectOneMenu value="#{materialsBean.equipmentsTypes.name}" effect="fold" editable="true">
                <f:selectItem itemLabel="Выберите тип материала" itemValue="" />
                <f:selectItems value="#{materialsBean.typesList}" />
            </p:selectOneMenu>

            <h:outputLabel for="material_description" value="Описание материала"/>
            <p:inputTextarea id="material_description" value="#{materialsBean.equipment.description}" rows="5"
                             cols="20"/>

            <f:facet name="footer">
                <p:commandButton value="Сохранить" actionListener="#{materialsBean.saveMaterial}"
                                 oncomplete="handleAddMaterialRequest(xhr, status, args)"/>
            </f:facet>
        </h:panelGrid>
    </h:form>
</h:body>

</html>